#!/usr/bin/python3
# -*- coding:utf-8 -*-
""""
   @Author: 即将拥有人鱼线的yjw
   @Time: 2023/12/13 19:24
   @File: test001.py
   @desc:
"""
""""
   @Author: 叶建伟
   @Email: yejw46507@hundsun.com
   @Time: 2023/7/5 13:58
   @File: threadInsertBTA.py
"""
import threading
import queue
from queue import Empty

from DataTest.databases import MysqlUtil, DaMengUtil
from DataTest.sqlmontage.SQLMontage import get_sql_key, montage_sql_value, get_sql
from DataTest.sqlmontage.clientInfo import client_info_list, client_info_srm, cst_unit_list, bank_txn_list, \
    securities_acc_list, capital_acc_list, risk_new_list, risk_his_list, settle_type, multi_bank_txn_list, deliver_list, \
    sus_report_list, tran_his_list
import datetime

# 定义全局变量num_threads线程数量，num_inserts插入数据总量，batch_size单次插入数量

num_threads = 20
num_inserts = 10000
batch_size = 500
# table_name = 'samlps_63_tran_his'
table_name = 'samlps_63_sus_report'

db = DaMengUtil('hssamlps', 'hssamlps', '10.20.192.117')

date_list = [20231130,20231129,20231128,20231127,20231124,20231123,20231122,20231121,20231120,20231117,20231116,20231115,20231114,20231113,20231110,20231109,20231108,20231107,20231106,20231103,20231102,20231101]
def insert():
    num_1 = 10000
    for p in range(len(date_list)):
        date_str = date_list[p]
        for j in range(10):
            temp = '121212' + '00000000'
            table_value = get_sql(table=table_name)
            table_key = get_sql_key(table=table_name)
            sql_list = sus_report_list()
            sql = table_key
            for i in range(100):
                temp1 = num_1
                tem = str(temp1)
                client_id = temp[:14 - len(tem)] + tem
                sql_list.update({'client_id': client_id, 'client_name': "个人" + client_id,'occur_date':date_str, 'bid': temp1})
                values = montage_sql_value(table=table_value, sql_list=sql_list)
                sql += values
                num_1 = num_1+1
                if i < 99:
                    sql += ","
            print(sql)
            db.execsql(sql)

if __name__ == '__main__':
    insert()


